package com.pengtu.entity.project;

import java.util.Comparator;
import java.util.Date;
import java.util.Set;
import java.util.TreeSet;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Where;

import com.pengtu.entity.IdEntity;
import com.pengtu.entity.app.Attachment;

/**
 * 
 *   工程进度表
 * ProgressReport
 * 
 * 2011-7-27 下午02:10:17
 * 
 * @version 1.0.0
 *
 */
@Entity
@Table(name = "T_PROJ_PROGRESSREPORT")
public class ProgressReport extends IdEntity {

	/**
	 * serialVersionUID:
	 * 
	 * @since 1.0.0
	 */

	private static final long serialVersionUID = 1L;
	private ProjectInfo project;
	private String signId;
	private Double finishinvestmenttotal;
	private Double finishmileagetotal;
	private String scheduledescribe;
	private Double progressPercent;
	private Double finishInvestmentPercent;
	private String schedulefile;
	private String reportedperson;
	private String reportedorg;
	private Date reportedDate;
	private String remark;
	private Set<Attachment> attachmentSet = new TreeSet<Attachment>(
			new Comparator<Attachment>() {
				@Override
				public int compare(Attachment attFirst, Attachment attSecond) {
					// TODO Auto-generated method stub
					return attFirst.getCreateDate().compareTo(
							attSecond.getCreateDate());
				}
			}); // 附件

	@ManyToOne(cascade=CascadeType.ALL)
	@JoinColumn(name="PROJECTID")
	public ProjectInfo getProject() {
		return project;
	}

	public void setProject(ProjectInfo project) {
		this.project = project;
	}

	@Column(name = "SIGNID")
	public String getSignId() {
		return signId;
	}

	public void setSignId(String signId) {
		this.signId = signId;
	}

	@Column(name = "FINISHINVESTMENTTOTAL")
	public Double getFinishinvestmenttotal() {
		return finishinvestmenttotal;
	}

	public void setFinishinvestmenttotal(Double finishinvestmenttotal) {
		this.finishinvestmenttotal = finishinvestmenttotal;
	}

	@Column(name = "FINISHMILEAGETOTAL")
	public Double getFinishmileagetotal() {
		return finishmileagetotal;
	}

	public void setFinishmileagetotal(Double finishmileagetotal) {
		this.finishmileagetotal = finishmileagetotal;
	}

	@Column(name = "SCHEDULEDESCRIBE")
	public String getScheduledescribe() {
		return scheduledescribe;
	}

	public void setScheduledescribe(String scheduledescribe) {
		this.scheduledescribe = scheduledescribe;
	}

	@Column(name = "PROGRESSPERCENT")
	public Double getProgressPercent() {
		return progressPercent;
	}

	public void setProgressPercent(Double ProgressPercent) {
		this.progressPercent = ProgressPercent;
	}

	@Column(name = "SCHEDULEFILE")
	public String getSchedulefile() {
		return schedulefile;
	}

	public void setSchedulefile(String schedulefile) {
		this.schedulefile = schedulefile;
	}

	@Column(name = "REPORTEDPERSON")
	public String getReportedperson() {
		return reportedperson;
	}

	public void setReportedperson(String reportedperson) {
		this.reportedperson = reportedperson;
	}

	@Column(name = "REPORTEDORG")
	public String getReportedorg() {
		return reportedorg;
	}

	public void setReportedorg(String reportedorg) {
		this.reportedorg = reportedorg;
	}

	@Column(name = "REPORTEDDATE")
	public Date getReportedDate() {
		return reportedDate;
	}

	public void setReportedDate(Date reportedDate) {
		this.reportedDate = reportedDate;
	}

	@Column(name = "REMARK")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "FINISHINVESTMENTPERCENT")
	public Double getFinishInvestmentPercent() {
		return finishInvestmentPercent;
	}

	public void setFinishInvestmentPercent(Double finishInvestmentPercent) {
		this.finishInvestmentPercent = finishInvestmentPercent;
	}
	
	@OneToMany(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
	@JoinColumn(name = "TABLEID")
	@Where(clause="delFlag = 0")
	public Set<Attachment> getAttachmentSet() {
		return attachmentSet;
	}

	public void setAttachmentSet(Set<Attachment> attachmentSet) {

		this.attachmentSet = attachmentSet;
	}
}
